<template>
  <aside class="video-layout-aside">
    <div class="header">
      <h2>视频会议</h2>
      <el-button icon="Setting"></el-button>
    </div>
    <div class="body">
      <div class="menu-item" v-for="(item, index) in menuList" v-bind:key="index" v-bind:class="{active:index===menuActive}" v-on:click="handleMenuItemChange(index)">
        <el-icon class="icon">
          <component v-bind:is="item.icon"/>
        </el-icon>
        <p class="label">{{ item.label }}</p>
      </div>
    </div>
  </aside>
  <router-view class="video-layout-page"/>
</template>

<script>
export default {
  data() {
    return {
      menuActive: -1,
      menuList: [
        {label: "发起会议", icon: "VideoCamera", path: "/video/create"},
        {label: "加入会议", icon: "Plus", path: "/video/join"},
        {label: "预约会议", icon: "User", path: "/video/wait"},
        {label: "会议室投屏", icon: "VideoCameraFilled", path: "/video/transfer"},
        {label: "秒记", icon: "Document", path: "/video/doc"},
        {label: "电话", icon: "Iphone", path: "/video/phone"}
      ]
    }
  },
  methods: {
    handleMenuItemChange(index) {
      this.menuActive = index;
      let path = this.menuList[index].path;
      if (path) {
        this.$router.push({path: path});
      }
    }
  }
}
</script>

<style scoped>
.video-layout-aside {
  width: 400px;
  background-color: #1A1A1A;
}

.video-layout-aside .header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 0;
}

.video-layout-aside .body {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.video-layout-aside .body .menu-item {
  margin-left: 20px;
  width: calc((100% - 20px * 3) / 2);
  padding: 20px;
  cursor: pointer;
  margin-top: 20px;
  border-radius: 10px;
  background-color: rgba(34, 43, 73, 0.8);
  transition: background-color 200ms;
}

.video-layout-aside .body .menu-item .icon {
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-color: rgba(54, 79, 162, 0.8);
  transition: background-color 200ms;
}

.video-layout-aside .body .menu-item:not(.active):hover {
  background-color: rgba(34, 43, 73, 1);
}

.video-layout-aside .body .menu-item:not(.active):hover .icon {
  background-color: rgba(54, 79, 162, 1);
}

.video-layout-aside .body .menu-item.active {
  background-color: rgba(29, 52, 27, 0.8);
}

.video-layout-aside .body .menu-item.active .icon {
  background-color: rgba(43, 108, 36, 0.8);
}

.video-layout-aside .body .menu-item.active:hover {
  background-color: rgba(29, 52, 27, 1);
}

.video-layout-aside .body .menu-item.active:hover .icon {
  background-color: rgba(43, 108, 36, 1);
}

.video-layout-aside .body .menu-item .label {
  font-size: 14px;
  margin-top: 10px;
}

.video-layout-page {
  width: calc(100% - 400px);
  background-color: #121212;
  padding: 20px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}
</style>